package cn.bgs.service.impl;

import cn.bgs.dao.GradeMapper;
import cn.bgs.pojo.Grade;
import cn.bgs.service.GradeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GradeServiceImpl implements GradeService {

    @Autowired private GradeMapper gradeMapper;

    @Override
    public PageInfo<Grade> findAll(Integer pageNum, Integer pageSiz) {
        PageHelper.startPage(pageNum,pageSiz);

        List<Grade> list=gradeMapper.findAll();
        PageInfo<Grade> ff=new PageInfo<>(list);
        return ff;

    }

    @Override
    public void deleteGrade(Integer pkId) {
       gradeMapper.deleteGrade(pkId);
    }

    @Override
    public List<Grade> findAllLayui() {
        return gradeMapper.findAllLayui();
    }

    @Override
    public Grade selectByPrimaryKey(Integer pkId) {
        return gradeMapper.selectByPrimaryKey(pkId);
    }

    @Override
    public int updateByPrimaryKeySelective(Grade record) {
        return gradeMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public PageInfo<Grade> gradeQuery(Integer pageSiz, Integer pageNum, Grade grade) {
        PageHelper.startPage(pageNum,pageSiz);

        List<Grade> list=gradeMapper.gradeQuery(grade);
        PageInfo<Grade> ff=new PageInfo<>(list);
        return ff;
    }


}
